PROJECT(ohmmsf77)

SET(FSOURCES addmult)
FOREACH(source ${FSOURCES})
   ADD_CUSTOM_COMMAND(
     OUTPUT ${ohmmsf77_BINARY_DIR}/${source}.o
     DEPENDS ${ohmmsf77_SOURCE_DIR}/${source}.f
     COMMAND ${F77}
     ARGS ${F77FLAGS} -c -o ${ohmmsf77_BINARY_DIR}/${source}.o
          ${ohmmsf77_SOURCE_DIR}/${source}.f
     )
   SET(OUTPUTS ${OUTPUTS} ${ohmmsf77_BINARY_DIR}/${source}.o)
ENDFOREACH(source)

ADD_CUSTOM_COMMAND(
   OUTPUT ${LIBRARY_OUTPUT_PATH}/libohmmsf77.a
   DEPENDS ${OUTPUTS}
   COMMAND ar
   ARGS ${AR_OPTIONS} cr ${LIBRARY_OUTPUT_PATH}/libohmmsf77.a ${OUTPUTS}
   )
 
ADD_CUSTOM_COMMAND(
   OUTPUT f77fix
   DEPENDS ${LIBRARY_OUTPUT_PATH}/libohmmsf77.a
   COMMAND ranlib
   ARGS ${LIBRARY_OUTPUT_PATH}/libohmmsf77.a
   )
 
ADD_CUSTOM_TARGET(libohmmsf77.a ALL ${CMAKE_COMMAND} -E echo DEPENDS
   f77fix ${LIBRARY_OUTPUT_PATH}/libohmmsf77.a)
